const db = require('../DBmiddle/db');
class HeorsModle {
  findAll() {
    return db.query('select * from heors where status=1', []);
  }
  findById(id) {
    return db.query('select * from heors where status=1 and id=?', [id]);
  }
  findStatus(name) {
    return db.query('select * from heors where status=0 and name=?', [name]);
  }
  upDate(body, id) {
    return db.query('update heors set ? where id = ?', [body, id]);
  }
  upStatus(time, name) {
    return db.query('update heors set status=1 , add_time=? where name = ?', [time, name]);
  }
  delete(id) {
    return db.query('update heors set status=0 where id = ?', [id]);
  }
  creat(body) {
    return db.query('insert into heors set ?', [body]);
  }
}
module.exports = new HeorsModle();